<template>
	<view class="space-between commodity" @click="shoppAll.is_show&&shoppAll.is_show!='1'||jump=='1'?'':ViewDetails(shoppAll.id,shoppAll.store_id,shoppAll.status,shoppAll.goods_type)">
		<view class="left_commodity">
			<image :src="shoppAll.image?shoppAll.image:shoppAll.goods_image" mode=""></image>
			<image :src="Platform" mode="" v-if="type=='subsidy'"></image>
			<view class="text" v-if="shoppAll.is_show&&shoppAll.is_show!='1'"><text>已暂停</text></view>
		</view>
		<view class="right_commodity" v-if="state=='team'">
			<view class="title" :style="{color:shoppAll.status!='1'?'#666':'#333'}">{{shoppAll.name?shoppAll.name:shoppAll.goods_name}}</view>
			<view class="text">{{shoppAll.subtitle?shoppAll.subtitle:shoppAll.goods_subtitle}}</view>
			<view class="space-between" v-if="shoppAll.status=='1'">
				<text :style="{maxWidth:'95%'}">{{shoppAll.dispatch_type?shoppAll.dispatch_type:shoppAll.dispatch_name}}</text>
			</view>
			<view class="pay" v-if="shoppAll.status=='1'"><text>￥</text><text>{{shoppAll.price}}</text><text>￥{{shoppAll.oprice}}</text></view>
			<view style="margin-top: 40rpx;color: #666;font-size: 26rpx;" v-if="shoppAll.status!='1'">商品已下架</view>
		</view>
		
		<view class="right_commodity" v-else>
			<view class="title">{{shoppAll.name?shoppAll.name:shoppAll.goods_name}}</view>
			<view class="text">{{shoppAll.subtitle?shoppAll.subtitle:shoppAll.goods_subtitle}}</view>
			<view class="space-between">
				<text :style="{maxWidth:show?'95%':'60%'}">{{shoppAll.dispatch_type?shoppAll.dispatch_type:shoppAll.dispatch_name}}</text>
				<text v-if="type=='distance'">距离{{shoppAll.distance}}</text>
				<text v-if="type=='num'">X{{shoppAll.goods_nums}}</text>
			</view>
			<view v-if="money=='stock'" class="space-between stock" style="width: 100%;">
				<view>
					<text>存货：</text>
				    <text style="font-size: 28rpx;">{{shoppAll.goods_nums}}</text>
				</view>
				<text class="delivery" @click.stop="delivery(shoppAll.id,shoppAll.goods_nums,shoppAll.type,shoppAll.goods_id)">提货</text>
			</view>
			<view v-else-if="money=='delivery'" class="num">提货数量:{{shoppAll.goods_nums}}件</view>
			<view v-else class="pay"><text>￥</text><text>{{shoppAll.price}}</text><text>￥{{shoppAll.oprice}}</text></view>
		</view>
	</view>
</template>

<script setup lang="ts">
import { Platform } from '@/utils/Static';
	const props = defineProps({
	  type: { type: String },
	  money:{type:String},
	  shoppAll:{type:Object},
	  show:{ type: Boolean },
	  jump:{ type: String },
	  shopID:{ type: String },
	  state:{ type: String },
	  pauth:{ type: String }
	});
	const emit = defineEmits(['delivery','jumps']);
	function ViewDetails(num,storeId,status,type){ 
		if(props.pauth=='delivery'){
			emit('jumps',{num,storeId,status,type})
		}else if(props.pauth=='virtual'||props.shoppAll.type=='virtual'){
			var id=props.shoppAll.type=='virtual'?props.shoppAll.goods_id:num
			uni.navigateTo({
				url: '/pages/pointsMall/integralDetail?id='+id
			});
		}else{
			var id=props.jump=='group'?props.shoppAll.goods_id:num
			var shopID=props.shopID?props.shopID:storeId
			uni.navigateTo({
				url: '/pages/shopp/shopDetail?id='+id+'&storeId='+shopID
			});
		}
	}
	function delivery(id,num,type,goodsId){
		emit('delivery',{id,num,type,goodsId})
	}
</script>

<style scoped lang="less">
	@import url('../groupBenefits/less/shopGrid.less');
</style>